home *** CD-ROM | disk | FTP | other *** search
/ Mac Easy 2010 May / Mac Life Ubuntu.iso / casper / filesystem.squashfs / etc / init.d / system-tools-backends < prev    next >
Encoding:
Text File  |  2009-04-09  |  2.6 KB  |  101 lines

  1. #! /bin/sh
  2. ### BEGIN INIT INFO
  3. # Provides:          system-tools-backends
  4. # Required-Start:    $local_fs dbus
  5. # Required-Stop:     $local_fs dbus
  6. # Should-Start:         $syslog
  7. # Should-Stop:       $syslog
  8. # Default-Start:     2 3 4 5
  9. # Default-Stop:      1
  10. # Short-Description: Gnome System Tools Backends
  11. # Description:       The Gnome System Tools Backends daemon handles root-needed
  12. #                    operations to configure your machine with the Gnome System
  13. #             Tools.
  14. ### END INIT INFO
  15.  
  16. #
  17. # system-tools-backends
  18. #       dbus init script
  19. #
  20. #       (Stolen from the hal package, and updated to keep stealing from them)
  21. #           Written by Martin Waitz based on skeleton code
  22. #           written by Miquel van Smoorenburg <miquels@cistron.nl>.
  23. #           Modified for Debian 
  24. #           by Ian Murdock <imurdock@gnu.ai.mit.edu>.
  25. #
  26.  
  27. PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
  28. DAEMON=/usr/bin/system-tools-backends
  29. PIDDIR=/var/run
  30. PIDFILE=$PIDDIR/system-tools-backends.pid
  31. NAME=system-tools-backends
  32. DESC="System Tools Backends"
  33.  
  34. . /lib/lsb/init-functions
  35.  
  36. test -x $DAEMON || exit 0
  37.  
  38. set -e
  39.  
  40. do_start() {
  41.     if [ ! -d $PIDDIR ]; then
  42.       mkdir -p $PIDDIR
  43.     fi
  44.     if [ -f $PIDFILE ] && [ "$(readlink /proc/$(cat $PIDFILE)/exe)" = $DAEMON ]; then
  45.       log_begin_msg "$DESC already running"
  46.       log_end_msg 0
  47.     else
  48.       log_daemon_msg "Starting $DESC" "$NAME"
  49.       start-stop-daemon --start --startas $DAEMON --quiet --pidfile $PIDFILE
  50.       log_end_msg $?
  51.     fi
  52. }
  53.  
  54. do_stop() {
  55.     log_daemon_msg "Stopping $DESC" "$NAME"
  56.     start-stop-daemon --stop --oknodo --quiet --pidfile $PIDFILE --startas $DAEMON
  57.     log_end_msg $?
  58. }
  59.  
  60. case "$1" in
  61.   start)
  62.     do_start
  63.     ;;
  64.   stop)
  65.     do_stop
  66.     ;;
  67.   #reload)
  68.     #
  69.     # If the daemon can reload its config files on the fly
  70.     # for example by sending it SIGHUP, do it here.
  71.     #
  72.     # If the daemon responds to changes in its config file
  73.     # directly anyway, make this a do-nothing entry.
  74.     #
  75.     # echo "Reloading $DESC configuration files."
  76.     # start-stop-daemon --stop --signal 1 --quiet --pidfile \
  77.     #   /var/run/$NAME.pid --exec $DAEMON
  78.   #;;
  79.   restart|force-reload)
  80.     #
  81.     #   If the "reload" option is implemented, move the "force-reload"
  82.     #   option to the "reload" entry above. If not, "force-reload" is
  83.     #   just the same as "restart".
  84.     #
  85.   do_stop
  86.     sleep 5
  87.   do_start
  88.     ;;
  89.   status)
  90.     status_of_proc -p $PIDFILE $DAEMON $NAME && exit 0 || exit $?
  91.     ;;
  92.   *)
  93.     N=/etc/init.d/$NAME
  94.     # echo "Usage: $N {start|stop|restart|reload|force-reload|status}" >&2
  95.     log_success_msg "Usage: $N {start|stop|restart|force-reload|status}" >&2
  96.     exit 1
  97.     ;;
  98. esac
  99.  
  100. exit 0
  101.